using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class SlimeMoveState : EnemyState
{
    Enemy_Slime enemy;
    public SlimeMoveState(Enemy enemyBase, EnemyStateMachine enemyStateMachine, string animatorName, Enemy_Slime enemy) : base(enemyBase, enemyStateMachine, animatorName)
    {
        this.enemy = enemy;
    }

    public override void Enter()
    {
        base.Enter();
    }

    public override void Exit()
    {
        base.Exit();
    }

    public override void Update()
    {
        base.Update();
        enemy.rigid.velocity = new Vector2(enemy.moveSpeed * enemy.faceDir, rb.velocity.y);
        if (!enemy.isGround() || enemy.IsWall())
        {
            enemy.Flip();
            enemyStateMachine.ChangeState(enemy.slimeIdleState);
        }
    }
}
